﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using System.Data;
using System.Data.SqlClient;

namespace DAO
{
    public class CaLamViecDAO
    {
        public static List<CaLamViecDTO> SelectAll()
        {
            List<CaLamViecDTO> list = new List<CaLamViecDTO>();
            String strSql = "select * from CaLamViec";

            try
            {
                DataTable dt = SqlDataAccessHelper.ExcuteQuery(strSql);
                foreach (DataRow dr in dt.Rows)
                {
                    CaLamViecDTO clv = new CaLamViecDTO();
                    clv.MaCa = int.Parse(dr["MaCa"].ToString());
                    clv.TenCa = dr["TenCa"].ToString();
                    clv.ThoiGian = dr["ThoiGian"].ToString();
                    list.Add(clv);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return list;
        }
    }
}
